/*
 * ZmianaHasla.java
 *
 * Created on 2011-04-03, 11:23:51
 */
package medimg.widok.konto;

/**
 *
 * @author l0nger
 */
public class ZmianaHasla extends javax.swing.JDialog {

    /** Creates new form ZmianaHasla */
    public ZmianaHasla(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.setLocationRelativeTo(parent);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jPasswordFieldStareHaslo = new javax.swing.JPasswordField();
        jPasswordFieldNoweHaslo = new javax.swing.JPasswordField();
        jPasswordFieldNoweHaslo2 = new javax.swing.JPasswordField();
        jButtonAnuluj = new javax.swing.JButton();
        jLabelStareHaslo = new javax.swing.JLabel();
        jLabelNoweHaslo = new javax.swing.JLabel();
        jLabelNoweHaslo2 = new javax.swing.JLabel();
        jButtonOk = new javax.swing.JButton();

        jButton1.setText("OK");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Zmiana hasła");
        setModal(true);
        setName("ZmianaHasla"); // NOI18N
        setResizable(false);

        jButtonAnuluj.setText("Anuluj");
        jButtonAnuluj.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAnulujActionPerformed(evt);
            }
        });

        jLabelStareHaslo.setText("Stare hasło");

        jLabelNoweHaslo.setText("Nowe hasło");

        jLabelNoweHaslo2.setText("Powtórz nowe hasło");

        jButtonOk.setText("OK");
        jButtonOk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonOkActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelStareHaslo)
                            .addComponent(jLabelNoweHaslo)
                            .addComponent(jLabelNoweHaslo2))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPasswordFieldStareHaslo, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
                            .addComponent(jPasswordFieldNoweHaslo, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
                            .addComponent(jPasswordFieldNoweHaslo2, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jButtonOk)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonAnuluj)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelStareHaslo)
                    .addComponent(jPasswordFieldStareHaslo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelNoweHaslo)
                    .addComponent(jPasswordFieldNoweHaslo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelNoweHaslo2)
                    .addComponent(jPasswordFieldNoweHaslo2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(23, 23, 23)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonAnuluj)
                    .addComponent(jButtonOk))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonAnulujActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAnulujActionPerformed
        this.dispose();
    }//GEN-LAST:event_jButtonAnulujActionPerformed

    private void jButtonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOkActionPerformed
        // TODO tutaj na razie beda problemy, bo nie wiem czy mozna zmienic
        // haslo samemu sobie przez transakcje w bazie, szerszen powinien sie tym zajac
        // trzeba zrobic jeszcze ofc walidacje danych, czy nowe haslo jest takie samo jak jego powtorzenie
        // i czy stare haslo jest podane poprawnie (tu moze byc problem, bo skrypt musialby sie wylogowac z bazy
        // i sprobowac zalogowac na te stare haslo zeby sprawdzic czy bangla to, do omowienia jest ta sprawa
    }//GEN-LAST:event_jButtonOkActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                ZmianaHasla dialog = new ZmianaHasla(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButtonAnuluj;
    private javax.swing.JButton jButtonOk;
    private javax.swing.JLabel jLabelNoweHaslo;
    private javax.swing.JLabel jLabelNoweHaslo2;
    private javax.swing.JLabel jLabelStareHaslo;
    private javax.swing.JPasswordField jPasswordFieldNoweHaslo;
    private javax.swing.JPasswordField jPasswordFieldNoweHaslo2;
    private javax.swing.JPasswordField jPasswordFieldStareHaslo;
    // End of variables declaration//GEN-END:variables
}
